Skip to content

Add opt in newline tolerance settings - #1826

Merged
SimonCropp merged 1 commit into
mainfrom
newline-tolerance-settings
Jul 31, 2026
Merged

Add opt in newline tolerance settings#1826
SimonCropp merged 1 commit into
mainfrom
newline-tolerance-settings

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Restores, as opt in, the two tolerances removed in 7253acb.

VerifierSettings.FixNewlinesOnRead normalizes \r\n and \r to \n when reading verified files, instead of rejecting a verified file that contains a carriage return.

VerifierSettings.IgnoreTrailingNewline treats a verified file that ends in a single \n, where that newline accounts for the entire difference in length, as equal to the received content.

Both are global and guarded by ThrowIfVerifyHasBeenRun, so a module initializer is the only place to set them. That makes either a repo level fix requiring no per developer setup, which is what #1824 asks for.

Neither is a replacement for the .gitattributes and EditorConfig settings, and enabling them has side effects: line endings on disk diverge between accept workflows, the misconfiguration is no longer surfaced anywhere, diff output during a real mismatch is noisier, reported content no longer matches the bytes on disk, normalizing allocates, and IgnoreTrailingNewline can mask output that stops emitting a trailing newline. All documented in the new docs/newline-tolerance.md, linked from the exception message, the xml docs, and the doc index.

Closes #1824

Restores, as opt in, the two tolerances removed in 7253acb.

VerifierSettings.FixNewlinesOnRead normalizes \r\n and \r to \n when
reading verified files, instead of rejecting a verified file that
contains a carriage return.

VerifierSettings.IgnoreTrailingNewline treats a verified file that ends
in a single \n, where that newline accounts for the entire difference in
length, as equal to the received content.

Both are global and guarded by ThrowIfVerifyHasBeenRun, so a module
initializer is the only place to set them. That makes either a repo
level fix requiring no per developer setup, which is what #1824 asks
for.

Neither is a replacement for the .gitattributes and EditorConfig
settings, and enabling them has side effects: line endings on disk
diverge between accept workflows, the misconfiguration is no longer
surfaced anywhere, diff output during a real mismatch is noisier,
reported content no longer matches the bytes on disk, normalizing
allocates, and IgnoreTrailingNewline can mask output that stops emitting
a trailing newline. All documented in the new docs/newline-tolerance.md,
linked from the exception message, the xml docs, and the doc index.

Closes #1824
@SimonCropp SimonCropp added this to the 31.28.0 milestone Jul 31, 2026
@SimonCropp
SimonCropp merged commit af7b0b2 into main Jul 31, 2026
7 checks passed
@SimonCropp
SimonCropp deleted the newline-tolerance-settings branch July 31, 2026 23:28
This was referenced Aug 1, 2026
This was referenced Aug 4, 2026
legrab added a commit to legrab/pocok that referenced this pull request Aug 9, 2026
Updated [Verify.NUnit](https://github.com/VerifyTests/Verify) from
31.27.0 to 31.28.0.

<details>
<summary>Release notes</summary>

_Sourced from [Verify.NUnit's
releases](https://github.com/VerifyTests/Verify/releases)._

## 31.28.0

- [x] [#​1822](VerifyTests/Verify#1822) Option
to not scrub N instance Guids
- [x] [#​1825](VerifyTests/Verify#1825) Add
GuidFormats option to ScrubInlineGuids
- [x] [#​1826](VerifyTests/Verify#1826) Add opt
in newline tolerance settings

Commits viewable in [compare
view](VerifyTests/Verify@31.27.0...31.28.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Verify.NUnit&package-manager=nuget&previous-version=31.27.0&new-version=31.28.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Newline strictness requires manual setup per developer

1 participant